package com.woniuxy.trade.controller;

import com.woniuxy.common.dto.ProductDto;
import com.woniuxy.common.dto.RoomDto;
import com.woniuxy.common.exceptions.BusinessException;
import com.woniuxy.common.result.Result;
import com.woniuxy.common.result.enums.impl.BusinessCode;
import com.woniuxy.trade.entity.Product;
import com.woniuxy.trade.service.SellerService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@Slf4j
public class SellerController {
    @Autowired
    SellerService sellerService;

    /**
     * 卖家上传商品
     * @param productDto
     * @return
     */
    @PostMapping("/seller/uploadPro")
    @ApiOperation("卖家上传商品")
    public Result<Void> uploadPro(@RequestBody @Valid ProductDto productDto){
        sellerService.uploadPro(productDto);
        return Result.ok();
    }
    /**
     * 卖家拍卖商品
     */
    @PostMapping("/seller/salePro")
    @ApiOperation("卖家拍卖商品")
    public Result salePro(@RequestBody @Valid RoomDto roomDto){
        sellerService.salePro(roomDto);
        return  Result.ok();
    }

}
